package formbeans;

import java.util.ArrayList;
import java.util.List;

import org.mybeans.form.FormBean;

public class LikertChoiceForm extends FormBean {

	private String type;
	private String choice1;
	private String choice2;
	private String choice3;
	private String choice4;
	private String choice5;
	private String choice6;
	private String choice7;
	
	public String getType() {
		return type;
	}
	public String getChoice1() {
		return choice1;
	}
	public String getChoice2() {
		return choice2;
	}
	public String getChoice3() {
		return choice3;
	}
	public String getChoice4() {
		return choice4;
	}
	public String getChoice5() {
		return choice5;
	}
	public String getChoice6() {
		return choice6;
	}
	public String getChoice7() {
		return choice7;
	}

	public void setType(String type) {
		this.type = type;
	}
	public void setChoice1(String choice1) {
		this.choice1 = trimAndConvert(choice1,"<>\"");
	}
	public void setChoice2(String choice2) {
		this.choice2 = trimAndConvert(choice2, "<>\"");
	}
	public void setChoice3(String choice3) {
		this.choice3 = trimAndConvert(choice3, "<>\"");
	}
	public void setChoice4(String choice4) {
		this.choice4 = trimAndConvert(choice4, "<>\"");
	}
	public void setChoice5(String choice5) {
		this.choice5 = trimAndConvert(choice5, "<>\"");
	}
	public void setChoice6(String choice6) {
		this.choice6 = trimAndConvert(choice6, "<>\"");
	}
	public void setChoice7(String choice7) {
		this.choice7 = trimAndConvert(choice7, "<>\"");
	}
	
	public List<String> checkLikertChoiceFormErrors(String num){
		List<String> errors = new ArrayList<String>();
		
		if(choice1 == null || choice1.length() == 0){
			errors.add("Please enter description for First choice");
		}
		if(choice2 == null || choice2.length() == 0){
			errors.add("Please enter description for Second choice");
		}
		if(choice3 == null || choice3.length() == 0){
			errors.add("Please enter description for Third choice");
		}
		if(choice4 == null || choice4.length() == 0){
			errors.add("Please enter description for Fourth choice");
		}
		if(choice5 == null || choice5.length() == 0){
			errors.add("Please enter description for Fifth choice");
		}
		if (num.equals("seven")) {
			if(choice6 == null || choice6.length() == 0){
				errors.add("Please enter description for Sixth choice");
			}
			if(choice7 == null || choice7.length() == 0){
				errors.add("Please enter description for Seventh choice");
			}
		}
		
		return errors;
	}
}